Szerkesztő:Tgr/summary.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
/* automatically set default value for summary fields
* (elements with wpSummary or wpReason id)
* (except for new section summary)
* install a button to set/change default value
* TODO: touched flag for summary field/minor edit checkbox
* to avoid overwriting manually specified values when hitting back button
*/
function autoSummary() {
var summaryText = $.cookie( 'autosummary' );
var r = prompt('Összefoglaló szövege:', summaryText);
if ( r !== null ) { // user pressed Ok
if ( r ) {
if ( r.match( /^\(m\)/ ) ) { // mark edit as minor
$('#wpMinoredit').attr('checked', true);
r = r.replace(/^\(m\) */, '');
}
var summary = document.getElementById('wpSummary');
if(!summary) summary = document.getElementById('wpReason');
if(summary.value.match(/^(\/\*.*\*\/)? *$/)) summary.value += r;
}
$.cookie( 'autosummary', r );
}
}
function autoSummaryInstall() {
$('#wpSummary,#wpReason').first().filter('[href~="§ion=new"]').each( function ( i, summary ) {
var summaryText = $.cookie('autosummary');
// set summary text
if(summaryText) {
if(summaryText.match(/^\(m\)/)) { // mark edit as minor
$('#wpMinoredit').attr('checked', true);
summaryText = summaryText.replace(/^\(m\) */, '');
}
if(summary.value.match(/^(\/\*.*\*\/)? *$/)) summary.value += summaryText; // avoid overwriting summary when using back button
}
// create button
var $autoSummaryButton = $('<a id="autosummary">')
.addClass( summaryText ? 'internal' : 'new' )
.click( autoSummary )
.text( '[auto]' );
$( summary ).after( $autoSummaryButton );
} );
}
$(autoSummaryInstall);